package com.wolf.wztoyy;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;

import javazoom.jl.player.Player;

public class Play {

	public static void main(String[] args) {
		String fileName = "F:/Testly/语音文件/789.mp3";
		new Play(fileName).play();
	}
	
	Player player;
    File music;
    //构造方法  参数是一个.mp3音频文件
    public Play(String filePath) {
    	File file = new File(filePath);
        this.music = file;
    }
    public Play(File file) {
        this.music = file;
    }
    //播放方法
    public void play() {

            try {
				BufferedInputStream buffer = new BufferedInputStream(new FileInputStream(music));
				player = new Player(buffer);
				player.play();
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
    }
	
}
